﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

public partial class UserDefinedFunctions
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlInt32 Year_Persian(SqlDateTime dateInput, bool convertToLocal)
    {
        if (dateInput.IsNull)
            return SqlInt32.Null;
        else
            return new SqlInt32(cPersian.GetYear((convertToLocal) ? dateInput.Value.ToLocalTime() : dateInput.Value));
    }
};

